// com/school/entities/Teacher.java
package com.school.entities;

import java.util.ArrayList;
import java.util.List;

public class Teacher extends Person {
    private List<Course> taughtCourses;

    public Teacher(String teacherId, String name, String gender) {
        super(teacherId, name, gender);
        this.taughtCourses = new ArrayList<>();
    }

    public Course openCourse(String courseId, String courseName, String location, String time) {
        Course course = new Course(courseId, courseName, location, time, this);
        taughtCourses.add(course);
        return course;
    }

    @Override
    public void printWorkSheet() {
        System.out.println("=== " + name + " 的教学任务表 ===");
        if (taughtCourses.isEmpty()) {
            System.out.println("暂无教学任务");
            return;
        }
        System.out.println("编号\t课程名称\t上课地点\t时间");
        for (Course course : taughtCourses) {
            System.out.println(course.getCourseId() + "\t" +
                    course.getCourseName() + "\t" +
                    course.getLocation() + "\t" +
                    course.getTime());
        }
    }

    public int getTeachingCourseCount() {
        return taughtCourses.size();
    }
}